from enum import Enum


@dataclass
class FormItemDto:
    form_desc: str  # 表单名称
    form_key: str  # 表单主键
    form_value: str  # 表单值
    form_value_type: str  # 表单值类型
    form_max: int = None  # 表单最大值
    form_min: int = None  # 表单最小值
    form_table: str = None  # 表单关联表


class FormItemsKey(Enum):
    # 配置键枚举
    STOCK_MONEY = (
        "setting.stock.money.all",
        FormItemDto("总资金量", "setting.stock.money.all", "100000", "int"),
    )
    TUSHARE_TOKEN = (
        "setting.app.tushare.token",
        FormItemDto("Tushare Token", "setting.app.tushare.token", "", "text"),
    )

    def __init__(self, key: str, form_item: FormItemDto):
        self.key = key
        self.form_item = form_item

    def __str__(self):
        return self.key
